//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "settings_server.h"
#include "unit_server.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TFormSettingsServer *FormSettingsServer;
//---------------------------------------------------------------------------
__fastcall TFormSettingsServer::TFormSettingsServer(TComponent* Owner)
    : TForm(Owner)
{
   TIniFile *ini;
   ini = new TIniFile( ChangeFileExt( Forms::Application->ExeName, ".INI" ) );

 TWAIN_OrganizationLicense("zzz",520069446);
 int c_scan = TWAIN_GetSourceList();

 AnsiString t_name_scan="!";
 while(t_name_scan!="")
 {
 t_name_scan=TWAIN_NextSourceName();
 ComboBoxScan->Items->Add(t_name_scan);
 }
   t_name_scan=  ini->ReadString( "LocalScanner", "NameScanner","" );
   ComboBoxScan->ItemIndex=ComboBoxScan->Items->IndexOf(t_name_scan);
   Form1->NameScan = t_name_scan;
   
   EditPort->Text = ini->ReadString( "ServerScanner", "Port","");
   CheckBoxDelFile->Checked  = ini->ReadBool("ServerScanner","DelInCache",false);
   CheckBoxDebug->Checked  = ini->ReadBool("ServerScanner","Debug",false);
   Form1->DeleteFileInCache = CheckBoxDelFile->Checked;
   Form1->inLog= CheckBoxDebug->Checked;
   delete ini;
}
//---------------------------------------------------------------------------
void __fastcall TFormSettingsServer::Button1Click(TObject *Sender)
{
   TIniFile *ini;
   ini = new TIniFile( ChangeFileExt( Forms::Application->ExeName, ".INI" ) );
   ini->WriteString( "LocalScanner", "NameScanner",ComboBoxScan->Text);
   ini->WriteString( "ServerScanner", "Port",EditPort->Text);
   ini->WriteBool( "ServerScanner", "DelInCache",CheckBoxDelFile->Checked);
   ini->WriteBool( "ServerScanner", "Debug",CheckBoxDebug->Checked);
   delete ini;
this->Hide();
}
//---------------------------------------------------------------------------
